﻿using System.Collections.Generic;

namespace Vkontakte.Api.Operations
{
	[ApiMethod("places.getCityById")]
	public sealed class PlacesGetCityById
		: Base30ApiOperation
	{
		private List<int> _cities=new List<int>();

		private City[] _result;

		protected override void Compile()
		{
			AddParameter( "method", "places.getCityById" );
			string cids = _cities[ 0 ].ToString();
			for ( int i = 1; i < _cities.Count; i++ )
			{
				cids += "," + _cities[ i ];
			}
			base.Compile();
		}

		protected override void ParseData(string data)
		{
			ListingResponce r = Serializer.LoadObjectXmlString<ListingResponce>(data);
			_result = r.Cities;
			base.ParseData(data);
		}

		protected internal override bool CheckParams()
		{
			return _cities.Count != 0;
		}

		public IList<int> Cities
		{
			get { return _cities; }
		}

		public City[] GetResult()
		{
			return _result;
		}
	}

	//
	[ApiMethod("wall.getPhotoUploadServer")]
	public sealed class WallGetPhotoUploadServer
		: Base30ApiOperation
	{
		protected override void Compile()
		{
			AddParameter("method", "wall.getPhotoUploadServer");
			base.Compile();
		}

		protected override void ParseData(string data)
		{
			base.ParseData(data);
		}
	}
}